const pool = require("@/db");
const table = require("@/db/table");

/**
 *
 * @param {*} titleArrayString  "吃奶奶,拉臭臭,拔奶奶"
 * @returns
 */
exports.todayNbStatistic = async () => {
  var sqlQuery = ` 
SELECT
  COUNT(*) AS count,
  SUM( num ) AS total,
  MAX( num ) AS max,
  MIN( num ) AS min,
  title 
FROM
  ${table.NBTHING} 
WHERE
  DATE ( start_at ) = CURDATE() 
GROUP BY
  title 
  `;
  return await pool.sql(sqlQuery).execute();
};
